using System;
using System.Collections.Generic;

namespace Managistics.Model
{
    [Serializable()]
    public class SaleOrderDetail : Entity<double>
    {
        private string _orderid;
        private string _itemId;
        private SaleOrder _saleOrder;
        private Good _good;
        private float? _quantity;
        private float? _discount;
        private float? _unitPrice;
        private bool? _statusItemC;
        private short? _vat;
        private string _remark;
        private int? _number;
        private string _department;
        private double _id;
        public virtual string Orderid
        {
            get
            {
                return this._orderid;
            }
            set
            {
                this._orderid = value;
            }
        }
        public virtual string ItemId
        {
            get
            {
                return this._itemId;
            }
            set
            {
                this._itemId = value;
            }
        }
        public virtual SaleOrder SaleOrder
        {
            get
            {
                return this._saleOrder;
            }
            set
            {
                this._saleOrder = value;
            }
        }
        public virtual Good Good
        {
            get
            {
                return this._good;
            }
            set
            {
                this._good = value;
            }
        }
        public virtual float? Quantity
        {
            get
            {
                return this._quantity;
            }
            set
            {
                this._quantity = value;
            }
        }
        public virtual float? Discount
        {
            get
            {
                return this._discount;
            }
            set
            {
                this._discount = value;
            }
        }
        public virtual float? UnitPrice
        {
            get
            {
                return this._unitPrice;
            }
            set
            {
                this._unitPrice = value;
            }
        }
        public virtual bool? StatusItem
        {
            get
            {
                return this._statusItemC;
            }
            set
            {
                this._statusItemC = value;
            }
        }
        public virtual short? Vat
        {
            get
            {
                return this._vat;
            }
            set
            {
                this._vat = value;
            }
        }
        public virtual string Remark
        {
            get
            {
                return this._remark;
            }
            set
            {
                this._remark = value;
            }
        }
        public virtual int? Number
        {
            get
            {
                return this._number;
            }
            set
            {
                this._number = value;
            }
        }
        public virtual string Department
        {
            get
            {
                return this._department;
            }
            set
            {
                this._department = value;
            }
        }
        public virtual double Id
        {
            get
            {
                return this._id;
            }
            set
            {
                this._id = value;
            }
        }
        #region NHibernate Composite Key Requirements
        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            var t = obj as SaleOrderDetail;
            if (t == null) return false;
            if (Orderid == t.Orderid
             && ItemId == t.ItemId)
                return true;

            return false;
        }
        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();
            hash = (hash * 397) ^ Orderid.GetHashCode();
            hash = (hash * 397) ^ ItemId.GetHashCode();

            return hash;
        }
        #endregion
    }

}
